-- if true then return {} end -- WARN: REMOVE THIS LINE TO ACTIVATE THIS FILE
return {
  {
    "AstroNvim/astroui",
    opts = {
      icons = {
        Target = "󰀘",
      },
    },
  },
  {
    "rebelot/heirline.nvim",
    opts = function(_, opts)
      local status = require "astroui.status"
      local status_utils = status.utils
      local hl = status.hl
      local condition = require "astroui.status.condition"
      local astro = require "astrocore"
      local is_available = astro.is_available
      local mode_opts = {
        mode_text = false,
        paste = false,
        spell = false,
        surround = { separator = "left", color = hl.mode_bg, update = { "ModeChanged", pattern = "*:*" } },
        hl = { fg = "#111111", bold = true },
        update = {
          "ModeChanged",
          pattern = "*:*",
          callback = function() vim.schedule(vim.cmd.redrawstatus) end,
        },
        str = { icon = { kind = "Target", padding = { left = 1, right = 0 } } },
      }
      local diag_opts = {
        ERROR = { icon = { kind = "DiagnosticError", padding = { left = 1, right = 1 } } },
        WARN = { icon = { kind = "DiagnosticWarn", padding = { left = 1, right = 1 } } },
        INFO = { icon = { kind = "DiagnosticInfo", padding = { left = 1, right = 1 } } },
        HINT = { icon = { kind = "DiagnosticHint", padding = { left = 1, right = 1 } } },
        surround = { separator = "left", color = "diagnostics_bg", condition = condition.has_diagnostics },
        hl = hl.get_attributes "diagnostics",
        on_click = {
          name = "heirline_diagnostic",
          callback = function()
            if is_available "telescope.nvim" then require("telescope.builtin").diagnostics() end
          end,
        },
        update = { "DiagnosticChanged", "BufEnter" },
      }
      opts.statusline[1] =
        status.component.builder(status_utils.setup_providers(mode_opts, { "str", "paste", "spell" }))
      opts.statusline[3] =
        status.component.file_info { filetype = {}, filename = false, file_modified = { padding = { left = 1 } } }
      opts.statusline[5] = status.component.builder(
        status_utils.setup_providers(diag_opts, { "ERROR", "WARN", "INFO" }, function(p_opts, p)
          local out = status_utils.build_provider(p_opts, p)
          if out then
            out.provider = "diagnostics"
            out.opts.severity = p
            if out.hl == nil then out.hl = { fg = "diag_" .. p } end
          end
          return out
        end)
      )
      opts.statusline[10] = status.component.virtual_env {
        on_click = {
          callback = function()
            if is_available "venv-selector.nvim" then vim.cmd.VenvSelect() end
          end,
          name = "heirline_statusline_venv_selector",
        },
      }
      return opts
    end,
  },
}
